package com.example.testgit.controller;

import com.example.testgit.VO.*;
import com.example.testgit.service.AwardPunishmentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author: lyh
 * @create: 2023/5/8 19:54
 * Description：
 */
@RestController
@RequestMapping("/award_punishment")
public class AwardPunishmentController {

    @Resource
    private AwardPunishmentService awardPunishmentService;

    /**
     * 通过解析对象中type判断查询类别
     * 0：奖学金
     * 1：竞赛
     * 2：助学金
     * 返回奖励列表
     * @param
     * @return
     */
    @PostMapping("/award")
    public Result<PageResult<AwardVO>> queryAward(@RequestBody StudentQuery stu) {
        PageResult<AwardVO> result = awardPunishmentService.queryAward(stu);
        return Result.success(result);
    }

    /**
     * 查询助学贷款列表
     * @param
     * @return
     */
    @PostMapping("/loan")
    public Result<PageResult<LoanVO>> queryLoan(@RequestBody StudentQuery stu) {
        PageResult<LoanVO> result = awardPunishmentService.queryLoan(stu);
        return Result.success(result);
    }

    /**
     * 查询勤工助学情况
     * 返回学生勤工助学总次数，总工时以及本年度工时分布（数组记录）
     * @param
     * @return
     */
    @GetMapping("/work_study")
    public Result<WorkStudyVO> queryWorkStudy(Integer stuId) {
        WorkStudyVO result = awardPunishmentService.queryWorkStudy(stuId);
        return Result.success(result);
    }

    /**
     * 查询惩处情况
     * 返回惩处列表以及惩处情况统计
     * @param
     * @return
     */
    @PostMapping("/punishment")
    public Result<PageResult<PunishmentVO>> queryPunishment(@RequestBody StudentQuery stu) {
        PageResult<PunishmentVO> result = awardPunishmentService.queryPunishment(stu);
        return Result.success(result);
    }
}
